package com.esdc.librarysystem.entity;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class TitleEntity implements Serializable {

    @Id
    private String ISBN;
    private String title;
    private String author;
    private String publisher;
    @OneToMany(cascade=CascadeType.ALL, mappedBy="title")
    private Set<BookEntity> books;

    public TitleEntity() {
    }

    public void create (String ISBN, String author, String publisher, String title) {
        this.setISBN(ISBN);
        this.setAuthor(author);
        this.setPublisher(publisher);
        this.setTitle(title);
    }

    public String getISBN() {
        return ISBN;
    }

    public void setISBN(String id) {
        this.ISBN = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public Set<BookEntity> getBooks() {
        return books;
    }

    public void setBooks(Set<BookEntity> books) {
        this.books = books;
    }

}
